# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
pkgname=purpose
pkgver=6.1.0
pkgrel=0
pkgdesc="Framework for providing abstractions to get the developer's purposes fulfilled"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x and riscv64 blocked by qt6-qtwebengine -> kaccounts-integration
arch="all !armhf !ppc64le !s390x !riscv64"
url="https://community.kde.org/Frameworks"
license="LGPL-2.1-or-later"
depends_dev="
	kconfig-dev
	kcoreaddons-dev
	ki18n-dev
	kio-dev
	kirigami-dev
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-lang"
_repo_url="https://invent.kde.org/frameworks/purpose.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/purpose-$pkgver.tar.xz"

replaces="purpose5"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_TESTING=ON
	cmake --build build
}

check() {
	case "$CARCH" in
		s390x|x86|armv7) xvfb-run ctest --test-dir build --output-on-failure -E '(menu|alternativesmodel)test' ;;
		*) xvfb-run ctest --test-dir build --output-on-failure -E 'menutest' ;;
 	esac
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
a52b365c3e33966e2557529d63a9cab8af66d1ea976a47e9aeee62755897bada371ad16f758abefb47201728e371f050c40fd88d29b9584445b4c816e954ff78  purpose-6.1.0.tar.xz
"
